Skip to content

Improve VirtualThread context tracking instrumentation#11009

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomasterfrom
bbujon/virtual-threads
Apr 7, 2026
Merged

Improve VirtualThread context tracking instrumentation#11009
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomasterfrom
bbujon/virtual-threads

Conversation

@PerfectSlayer
Copy link
Copy Markdown
Contributor

@PerfectSlayer PerfectSlayer commented Mar 31, 2026

What Does This Do

This PR addresses the following issues with VirtualThread instrumentation:

Motivation

I did not check at bytecode level the changes from the original PRs and that was wrong. That introduces regression and keep pushing in the wrong direction. This is a basically a redo of the instrumentation using context swap and continuation.

Additional Notes

This PR also mirrors the context testing capability from the JUnit instrumentation tests.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@PerfectSlayer PerfectSlayer added type: bug Bug report and fix comp: context propagation Trace context propagation inst: java Core Java language instrumentation labels Mar 31, 2026
@PerfectSlayer PerfectSlayer changed the title Prevent duplicate instrumentation conflict between VirtualThread and Runnable Improve VirtualThread instrumentation Apr 2, 2026
Replaces the `ConcurrentState` approach (which activated/closed individual scopes) with `VirtualThreadState` that swaps the entire scope stack via `Context#swap()`. This correctly handles child spans created during virtual thread execution and avoids out-of-order scope closing. The new approach mirrors the ZIO FiberContext and Kotlin coroutines instrumentation patterns.
@PerfectSlayer PerfectSlayer force-pushed the bbujon/virtual-threads branch from ea327b5 to d0e39d9 Compare April 3, 2026 14:58
Replaces the `ConcurrentState` approach (which activated/closed individual scopes) with `VirtualThreadState` that swaps the entire scope stack via `Context#swap()`. This correctly handles child spans created during virtual thread execution and avoids out-of-order scope closing. The new approach mirrors the ZIO FiberContext and Kotlin coroutines instrumentation patterns.
@PerfectSlayer PerfectSlayer force-pushed the bbujon/virtual-threads branch from 2788193 to 45d06be Compare April 3, 2026 15:37
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 3, 2026

Benchmarks

⚠️ Warning: Baseline build not found for merge-base commit. Comparing against the latest commit on master instead.

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1776157553 1776156922
git_commit_sha f89a0b26cc 3cba921
release_version 1.62.0-SNAPSHOT~9f89a0b26cc 1.62.0-SNAPSHOT~3cba9218f8
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1776158846 1776158846
ci_job_id 1592495565 1592495565
ci_pipeline_id 107531744 107531744
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-63vsev0j 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-63vsev0j 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 10 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.057 s) : 0, 1056521
Total [baseline] (8.873 s) : 0, 8873240
Agent [candidate] (1.058 s) : 0, 1058469
Total [candidate] (8.827 s) : 0, 8827099
section iast
Agent [baseline] (1.223 s) : 0, 1222832
Total [baseline] (9.529 s) : 0, 9528671
Agent [candidate] (1.222 s) : 0, 1221771
Total [candidate] (9.58 s) : 0, 9579991
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.057 s -
Agent iast 1.223 s 166.311 ms (15.7%)
Total tracing 8.873 s -
Total iast 9.529 s 655.431 ms (7.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent iast 1.222 s 163.302 ms (15.4%)
Total tracing 8.827 s -
Total iast 9.58 s 752.892 ms (8.5%)
gantt
    title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.246 ms) : 0, 1246
crashtracking [candidate] (1.236 ms) : 0, 1236
BytebuddyAgent [baseline] (631.519 ms) : 0, 631519
BytebuddyAgent [candidate] (633.293 ms) : 0, 633293
AgentMeter [baseline] (29.431 ms) : 0, 29431
AgentMeter [candidate] (29.462 ms) : 0, 29462
GlobalTracer [baseline] (248.441 ms) : 0, 248441
GlobalTracer [candidate] (249.364 ms) : 0, 249364
AppSec [baseline] (32.044 ms) : 0, 32044
AppSec [candidate] (32.034 ms) : 0, 32034
Debugger [baseline] (59.145 ms) : 0, 59145
Debugger [candidate] (59.221 ms) : 0, 59221
Remote Config [baseline] (601.385 µs) : 0, 601
Remote Config [candidate] (599.559 µs) : 0, 600
Telemetry [baseline] (8.107 ms) : 0, 8107
Telemetry [candidate] (8.041 ms) : 0, 8041
Flare Poller [baseline] (9.761 ms) : 0, 9761
Flare Poller [candidate] (8.907 ms) : 0, 8907
section iast
crashtracking [baseline] (1.236 ms) : 0, 1236
crashtracking [candidate] (1.245 ms) : 0, 1245
BytebuddyAgent [baseline] (799.968 ms) : 0, 799968
BytebuddyAgent [candidate] (799.815 ms) : 0, 799815
AgentMeter [baseline] (11.375 ms) : 0, 11375
AgentMeter [candidate] (11.377 ms) : 0, 11377
GlobalTracer [baseline] (239.256 ms) : 0, 239256
GlobalTracer [candidate] (238.983 ms) : 0, 238983
IAST [baseline] (25.79 ms) : 0, 25790
IAST [candidate] (25.758 ms) : 0, 25758
AppSec [baseline] (32.629 ms) : 0, 32629
AppSec [candidate] (31.677 ms) : 0, 31677
Debugger [baseline] (60.437 ms) : 0, 60437
Debugger [candidate] (62.741 ms) : 0, 62741
Remote Config [baseline] (532.757 µs) : 0, 533
Remote Config [candidate] (540.861 µs) : 0, 541
Telemetry [baseline] (11.99 ms) : 0, 11990
Telemetry [candidate] (10.021 ms) : 0, 10021
Flare Poller [baseline] (3.421 ms) : 0, 3421
Flare Poller [candidate] (3.435 ms) : 0, 3435
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.059 s) : 0, 1058575
Total [baseline] (11.149 s) : 0, 11148574
Agent [candidate] (1.067 s) : 0, 1066516
Total [candidate] (11.087 s) : 0, 11086530
section appsec
Agent [baseline] (1.257 s) : 0, 1256581
Total [baseline] (11.172 s) : 0, 11172243
Agent [candidate] (1.25 s) : 0, 1250318
Total [candidate] (11.181 s) : 0, 11180901
section iast
Agent [baseline] (1.225 s) : 0, 1224904
Total [baseline] (11.206 s) : 0, 11205822
Agent [candidate] (1.223 s) : 0, 1222807
Total [candidate] (11.253 s) : 0, 11252810
section profiling
Agent [baseline] (1.183 s) : 0, 1183214
Total [baseline] (11.067 s) : 0, 11066552
Agent [candidate] (1.184 s) : 0, 1183975
Total [candidate] (11.025 s) : 0, 11025470
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.059 s -
Agent appsec 1.257 s 198.006 ms (18.7%)
Agent iast 1.225 s 166.328 ms (15.7%)
Agent profiling 1.183 s 124.639 ms (11.8%)
Total tracing 11.149 s -
Total appsec 11.172 s 23.669 ms (0.2%)
Total iast 11.206 s 57.249 ms (0.5%)
Total profiling 11.067 s -82.022 ms (-0.7%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.067 s -
Agent appsec 1.25 s 183.802 ms (17.2%)
Agent iast 1.223 s 156.292 ms (14.7%)
Agent profiling 1.184 s 117.46 ms (11.0%)
Total tracing 11.087 s -
Total appsec 11.181 s 94.372 ms (0.9%)
Total iast 11.253 s 166.28 ms (1.5%)
Total profiling 11.025 s -61.059 ms (-0.6%)
gantt
    title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.258 ms) : 0, 1258
crashtracking [candidate] (1.25 ms) : 0, 1250
BytebuddyAgent [baseline] (633.406 ms) : 0, 633406
BytebuddyAgent [candidate] (636.82 ms) : 0, 636820
AgentMeter [baseline] (29.405 ms) : 0, 29405
AgentMeter [candidate] (29.737 ms) : 0, 29737
GlobalTracer [baseline] (249.171 ms) : 0, 249171
GlobalTracer [candidate] (250.458 ms) : 0, 250458
AppSec [baseline] (32.084 ms) : 0, 32084
AppSec [candidate] (32.165 ms) : 0, 32165
Debugger [baseline] (60.136 ms) : 0, 60136
Debugger [candidate] (60.329 ms) : 0, 60329
Remote Config [baseline] (601.056 µs) : 0, 601
Remote Config [candidate] (598.642 µs) : 0, 599
Telemetry [baseline] (8.059 ms) : 0, 8059
Telemetry [candidate] (8.162 ms) : 0, 8162
Flare Poller [baseline] (8.264 ms) : 0, 8264
Flare Poller [candidate] (10.673 ms) : 0, 10673
section appsec
crashtracking [baseline] (1.25 ms) : 0, 1250
crashtracking [candidate] (1.219 ms) : 0, 1219
BytebuddyAgent [baseline] (666.682 ms) : 0, 666682
BytebuddyAgent [candidate] (661.94 ms) : 0, 661940
AgentMeter [baseline] (12.116 ms) : 0, 12116
AgentMeter [candidate] (12.2 ms) : 0, 12200
GlobalTracer [baseline] (250.802 ms) : 0, 250802
GlobalTracer [candidate] (251.168 ms) : 0, 251168
IAST [baseline] (24.758 ms) : 0, 24758
IAST [candidate] (24.409 ms) : 0, 24409
AppSec [baseline] (185.428 ms) : 0, 185428
AppSec [candidate] (183.945 ms) : 0, 183945
Debugger [baseline] (66.162 ms) : 0, 66162
Debugger [candidate] (66.292 ms) : 0, 66292
Remote Config [baseline] (604.439 µs) : 0, 604
Remote Config [candidate] (604.942 µs) : 0, 605
Telemetry [baseline] (8.587 ms) : 0, 8587
Telemetry [candidate] (8.503 ms) : 0, 8503
Flare Poller [baseline] (3.518 ms) : 0, 3518
Flare Poller [candidate] (3.603 ms) : 0, 3603
section iast
crashtracking [baseline] (1.23 ms) : 0, 1230
crashtracking [candidate] (1.232 ms) : 0, 1232
BytebuddyAgent [baseline] (800.435 ms) : 0, 800435
BytebuddyAgent [candidate] (799.057 ms) : 0, 799057
AgentMeter [baseline] (11.387 ms) : 0, 11387
AgentMeter [candidate] (11.392 ms) : 0, 11392
GlobalTracer [baseline] (239.449 ms) : 0, 239449
GlobalTracer [candidate] (239.183 ms) : 0, 239183
IAST [baseline] (25.847 ms) : 0, 25847
IAST [candidate] (26.558 ms) : 0, 26558
AppSec [baseline] (31.216 ms) : 0, 31216
AppSec [candidate] (31.893 ms) : 0, 31893
Debugger [baseline] (62.644 ms) : 0, 62644
Debugger [candidate] (63.13 ms) : 0, 63130
Remote Config [baseline] (547.612 µs) : 0, 548
Remote Config [candidate] (555.675 µs) : 0, 556
Telemetry [baseline] (12.24 ms) : 0, 12240
Telemetry [candidate] (9.927 ms) : 0, 9927
Flare Poller [baseline] (3.517 ms) : 0, 3517
Flare Poller [candidate] (3.7 ms) : 0, 3700
section profiling
crashtracking [baseline] (1.188 ms) : 0, 1188
crashtracking [candidate] (1.176 ms) : 0, 1176
BytebuddyAgent [baseline] (690.565 ms) : 0, 690565
BytebuddyAgent [candidate] (690.651 ms) : 0, 690651
AgentMeter [baseline] (9.101 ms) : 0, 9101
AgentMeter [candidate] (9.173 ms) : 0, 9173
GlobalTracer [baseline] (206.98 ms) : 0, 206980
GlobalTracer [candidate] (207.445 ms) : 0, 207445
AppSec [baseline] (32.484 ms) : 0, 32484
AppSec [candidate] (32.542 ms) : 0, 32542
Debugger [baseline] (65.443 ms) : 0, 65443
Debugger [candidate] (65.703 ms) : 0, 65703
Remote Config [baseline] (562.399 µs) : 0, 562
Remote Config [candidate] (567.52 µs) : 0, 568
Telemetry [baseline] (7.876 ms) : 0, 7876
Telemetry [candidate] (7.84 ms) : 0, 7840
Flare Poller [baseline] (3.563 ms) : 0, 3563
Flare Poller [candidate] (3.572 ms) : 0, 3572
ProfilingAgent [baseline] (94.103 ms) : 0, 94103
ProfilingAgent [candidate] (93.996 ms) : 0, 93996
Profiling [baseline] (94.665 ms) : 0, 94665
Profiling [candidate] (94.579 ms) : 0, 94579
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1776157529 1776156922
git_commit_sha f89a0b26cc 3cba921
release_version 1.62.0-SNAPSHOT~9f89a0b26cc 1.62.0-SNAPSHOT~3cba9218f8
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1776159299 1776159299
ci_job_id 1592495567 1592495567
ci_pipeline_id 107531744 107531744
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-55pztpa7 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-55pztpa7 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 3 performance improvements and 0 performance regressions! Performance is the same for 17 metrics, 16 unstable metrics.

scenario Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p95 Δ mean throughput candidate mean agg_http_req_duration_p50 candidate mean agg_http_req_duration_p95 candidate mean throughput baseline mean agg_http_req_duration_p50 baseline mean agg_http_req_duration_p95 baseline mean throughput
scenario:load:petclinic:profiling:high_load better
[-1.865ms; -0.553ms] or [-9.723%; -2.883%]
unsure
[-2.297ms; -0.536ms] or [-7.442%; -1.737%]
unstable
[-12.935op/s; +41.248op/s] or [-5.390%; +17.189%]
17.975ms 29.446ms 254.125op/s 19.185ms 30.863ms 239.969op/s
scenario:load:petclinic:tracing:high_load better
[-1320.438µs; -602.404µs] or [-7.217%; -3.292%]
better
[-2.009ms; -0.649ms] or [-6.807%; -2.199%]
unstable
[-14.204op/s; +41.267op/s] or [-5.666%; +16.462%]
17.335ms 28.186ms 264.219op/s 18.297ms 29.516ms 250.688op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc
    dateFormat X
    axisFormat %s
section baseline
no_agent (18.412 ms) : 18223, 18600
.   : milestone, 18412,
appsec (18.759 ms) : 18572, 18947
.   : milestone, 18759,
code_origins (18.231 ms) : 18049, 18413
.   : milestone, 18231,
iast (18.952 ms) : 18767, 19136
.   : milestone, 18952,
profiling (19.455 ms) : 19259, 19650
.   : milestone, 19455,
tracing (18.616 ms) : 18429, 18803
.   : milestone, 18616,
section candidate
no_agent (19.108 ms) : 18916, 19299
.   : milestone, 19108,
appsec (18.715 ms) : 18523, 18907
.   : milestone, 18715,
code_origins (17.752 ms) : 17580, 17925
.   : milestone, 17752,
iast (19.013 ms) : 18827, 19200
.   : milestone, 19013,
profiling (18.364 ms) : 18181, 18546
.   : milestone, 18364,
tracing (17.657 ms) : 17481, 17833
.   : milestone, 17657,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.412 ms [18.223 ms, 18.6 ms] -
appsec 18.759 ms [18.572 ms, 18.947 ms] 347.459 µs (1.9%)
code_origins 18.231 ms [18.049 ms, 18.413 ms] -180.8 µs (-1.0%)
iast 18.952 ms [18.767 ms, 19.136 ms] 540.07 µs (2.9%)
profiling 19.455 ms [19.259 ms, 19.65 ms] 1.043 ms (5.7%)
tracing 18.616 ms [18.429 ms, 18.803 ms] 204.328 µs (1.1%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 19.108 ms [18.916 ms, 19.299 ms] -
appsec 18.715 ms [18.523 ms, 18.907 ms] -392.525 µs (-2.1%)
code_origins 17.752 ms [17.58 ms, 17.925 ms] -1.356 ms (-7.1%)
iast 19.013 ms [18.827 ms, 19.2 ms] -94.609 µs (-0.5%)
profiling 18.364 ms [18.181 ms, 18.546 ms] -743.99 µs (-3.9%)
tracing 17.657 ms [17.481 ms, 17.833 ms] -1.45 ms (-7.6%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.23 ms) : 1218, 1242
.   : milestone, 1230,
iast (3.284 ms) : 3234, 3334
.   : milestone, 3284,
iast_FULL (6.092 ms) : 6030, 6154
.   : milestone, 6092,
iast_GLOBAL (3.701 ms) : 3640, 3761
.   : milestone, 3701,
profiling (2.02 ms) : 2002, 2038
.   : milestone, 2020,
tracing (1.84 ms) : 1825, 1855
.   : milestone, 1840,
section candidate
no_agent (1.223 ms) : 1212, 1235
.   : milestone, 1223,
iast (3.228 ms) : 3187, 3269
.   : milestone, 3228,
iast_FULL (5.985 ms) : 5924, 6046
.   : milestone, 5985,
iast_GLOBAL (3.659 ms) : 3603, 3715
.   : milestone, 3659,
profiling (2.141 ms) : 2123, 2159
.   : milestone, 2141,
tracing (1.889 ms) : 1872, 1906
.   : milestone, 1889,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.23 ms [1.218 ms, 1.242 ms] -
iast 3.284 ms [3.234 ms, 3.334 ms] 2.054 ms (166.9%)
iast_FULL 6.092 ms [6.03 ms, 6.154 ms] 4.862 ms (395.2%)
iast_GLOBAL 3.701 ms [3.64 ms, 3.761 ms] 2.47 ms (200.8%)
profiling 2.02 ms [2.002 ms, 2.038 ms] 790.106 µs (64.2%)
tracing 1.84 ms [1.825 ms, 1.855 ms] 609.867 µs (49.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.223 ms [1.212 ms, 1.235 ms] -
iast 3.228 ms [3.187 ms, 3.269 ms] 2.004 ms (163.9%)
iast_FULL 5.985 ms [5.924 ms, 6.046 ms] 4.762 ms (389.3%)
iast_GLOBAL 3.659 ms [3.603 ms, 3.715 ms] 2.436 ms (199.1%)
profiling 2.141 ms [2.123 ms, 2.159 ms] 917.962 µs (75.0%)
tracing 1.889 ms [1.872 ms, 1.906 ms] 665.742 µs (54.4%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1776157529 1776156922
git_commit_sha f89a0b26cc 3cba921
release_version 1.62.0-SNAPSHOT~9f89a0b26cc 1.62.0-SNAPSHOT~3cba9218f8
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1776159084 1776159084
ci_job_id 1592495568 1592495568
ci_pipeline_id 107531744 107531744
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-acihh7sq 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-acihh7sq 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 1 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:dacapo:tomcat:appsec better
[-1.483ms; -1.135ms] or [-38.483%; -29.446%]
2.545ms 3.854ms
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.498 ms) : 1486, 1510
.   : milestone, 1498,
appsec (3.854 ms) : 3632, 4077
.   : milestone, 3854,
iast (2.279 ms) : 2210, 2348
.   : milestone, 2279,
iast_GLOBAL (2.328 ms) : 2258, 2397
.   : milestone, 2328,
profiling (2.101 ms) : 2046, 2156
.   : milestone, 2101,
tracing (2.099 ms) : 2045, 2152
.   : milestone, 2099,
section candidate
no_agent (1.499 ms) : 1487, 1511
.   : milestone, 1499,
appsec (2.545 ms) : 2491, 2600
.   : milestone, 2545,
iast (2.288 ms) : 2219, 2358
.   : milestone, 2288,
iast_GLOBAL (2.328 ms) : 2258, 2397
.   : milestone, 2328,
profiling (2.113 ms) : 2058, 2168
.   : milestone, 2113,
tracing (2.093 ms) : 2040, 2146
.   : milestone, 2093,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.498 ms [1.486 ms, 1.51 ms] -
appsec 3.854 ms [3.632 ms, 4.077 ms] 2.356 ms (157.3%)
iast 2.279 ms [2.21 ms, 2.348 ms] 781.258 µs (52.2%)
iast_GLOBAL 2.328 ms [2.258 ms, 2.397 ms] 829.487 µs (55.4%)
profiling 2.101 ms [2.046 ms, 2.156 ms] 602.947 µs (40.2%)
tracing 2.099 ms [2.045 ms, 2.152 ms] 600.573 µs (40.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.499 ms [1.487 ms, 1.511 ms] -
appsec 2.545 ms [2.491 ms, 2.6 ms] 1.046 ms (69.8%)
iast 2.288 ms [2.219 ms, 2.358 ms] 789.366 µs (52.7%)
iast_GLOBAL 2.328 ms [2.258 ms, 2.397 ms] 828.497 µs (55.3%)
profiling 2.113 ms [2.058 ms, 2.168 ms] 613.795 µs (40.9%)
tracing 2.093 ms [2.04 ms, 2.146 ms] 593.891 µs (39.6%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~3cba9218f8, baseline=1.62.0-SNAPSHOT~9f89a0b26cc
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.928 s) : 14928000, 14928000
.   : milestone, 14928000,
appsec (14.845 s) : 14845000, 14845000
.   : milestone, 14845000,
iast (18.446 s) : 18446000, 18446000
.   : milestone, 18446000,
iast_GLOBAL (18.098 s) : 18098000, 18098000
.   : milestone, 18098000,
profiling (15.189 s) : 15189000, 15189000
.   : milestone, 15189000,
tracing (14.936 s) : 14936000, 14936000
.   : milestone, 14936000,
section candidate
no_agent (14.857 s) : 14857000, 14857000
.   : milestone, 14857000,
appsec (14.944 s) : 14944000, 14944000
.   : milestone, 14944000,
iast (18.423 s) : 18423000, 18423000
.   : milestone, 18423000,
iast_GLOBAL (17.717 s) : 17717000, 17717000
.   : milestone, 17717000,
profiling (14.834 s) : 14834000, 14834000
.   : milestone, 14834000,
tracing (14.725 s) : 14725000, 14725000
.   : milestone, 14725000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.928 s [14.928 s, 14.928 s] -
appsec 14.845 s [14.845 s, 14.845 s] -83.0 ms (-0.6%)
iast 18.446 s [18.446 s, 18.446 s] 3.518 s (23.6%)
iast_GLOBAL 18.098 s [18.098 s, 18.098 s] 3.17 s (21.2%)
profiling 15.189 s [15.189 s, 15.189 s] 261.0 ms (1.7%)
tracing 14.936 s [14.936 s, 14.936 s] 8.0 ms (0.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.857 s [14.857 s, 14.857 s] -
appsec 14.944 s [14.944 s, 14.944 s] 87.0 ms (0.6%)
iast 18.423 s [18.423 s, 18.423 s] 3.566 s (24.0%)
iast_GLOBAL 17.717 s [17.717 s, 17.717 s] 2.86 s (19.3%)
profiling 14.834 s [14.834 s, 14.834 s] -23.0 ms (-0.2%)
tracing 14.725 s [14.725 s, 14.725 s] -132.0 ms (-0.9%)

@PerfectSlayer PerfectSlayer marked this pull request as ready for review April 3, 2026 17:11
@PerfectSlayer PerfectSlayer requested review from a team as code owners April 3, 2026 17:11
@PerfectSlayer PerfectSlayer requested review from dougqh and mcculls and removed request for a team April 3, 2026 17:11

/** Called on mount: swaps the virtual thread's context into the carrier thread. */
public void onMount() {
this.previousContext = this.context.swap();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that's the kind of API that I was imagining

Copy link
Copy Markdown
Contributor

@mcculls mcculls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@PerfectSlayer
Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 7, 2026

View all feedbacks in Devflow UI.

2026-04-07 08:31:13 UTC ℹ️ Start processing command /merge


2026-04-07 08:31:18 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-04-07 09:34:00 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit a1f4ec5 into master Apr 7, 2026
569 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the bbujon/virtual-threads branch April 7, 2026 09:33
@github-actions github-actions bot added this to the 1.61.0 milestone Apr 7, 2026
@PerfectSlayer PerfectSlayer changed the title Improve VirtualThread instrumentation Improve VirtualThread context tracking instrumentation Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: context propagation Trace context propagation inst: java Core Java language instrumentation type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants